<%@ page import="bean.Order" %>
<%@ page import="bean.OrderItem" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Arrays" %>
<%@ page import="service.impl.CinemaServiceImpl" %><%--
  Created by IntelliJ IDEA.
  User: Peter Zhou
 
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>订单详情</title>
    <style>
        body {
            font-family: 'Helvetica Neue', Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f7f7f7;
        }
        body {
            background-image: url('../img/ui/Order_details.jpg');
            background-size: cover;
            background-repeat: no-repeat;
            background-attachment: fixed; /* 可选，使背景图片固定不动 */
        }
        .container {
            max-width: 800px;
            margin: 20px auto;
            padding: 20px;
            border: 1px solid #ddd;
            border-radius: 5px;
            background-color: #fff;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            opacity: 0.8;
        }
        .order-info {
            display: flex;
            justify-content: space-between; /* 文字和图片之间的空间 */
            align-items: center; /* 让图片和文字垂直居中 */
            border-bottom: 1px solid #eee;
            padding-bottom: 20px;
            margin-bottom: 20px;
        }
        .order-info p {
            margin: 0;
            font-size: 16px;
            color: #555;
        }

    </style>
</head>

<body>
<div class="container">
    <%
        Order order =(Order) request.getSession().getAttribute("order");
        List<OrderItem> orderItemList= order.getOrderItemList();
        for(OrderItem orderItem :orderItemList) {
            String seat = orderItem.getSeat();
            String[] parts = seat.split("_");
            if (parts.length == 2) {
                orderItem.setSeat(parts[0] + "排" + parts[1] + "座");
            }
            request.setAttribute("orderItemList", orderItemList);
        }
    %>
    <div class="order-info">
        <p>影片:<%=order.getScreeningSchedule().getMovie().getName()%></p>
        <p>放映时间：<%=order.getScreeningSchedule().getStartTime()%> 到 <%=order.getScreeningSchedule().getEndTime()%>  </p>
    </div>
    <div class="order-info">
        <p>影院：<%=new CinemaServiceImpl().getCinemaById(order.getScreeningSchedule().getVideoHall().getCinemaId()).getName()%></p>
        <p><%=order.getScreeningSchedule().getVideoHall().getName()%>沙发软座免费3小时停车<br>
         <c:forEach var="orderItem" items="${orderItemList}">
             <c:forEach var="seat" items="${orderItem.seat}">
                ${seat}
             </c:forEach>
         </c:forEach>
        </p>
    </div>
    <div class="order-summary">
        <div style="display: flex; align-items: center;">
            <img src="../img/movie/<%=order.getScreeningSchedule().getMovie().getImg()%>" alt="图片描述" width="200" height="250" style="margin-right: 350px;">
            <div>
                <p>订单总额：<%=order.getTotal()%></p>
                <p>支付方式：在线支付</p>
                <p>下单时间：<%=order.getOrderDate()%></p>
            </div>
        </div>
    </div>
</div>
</body
></html>